# -*- coding: utf-8 -*-
# @Time    : 2024/2/25 21:59
# @Author  : micah
# @File    : 3.retry代码测试.py
# @Software: PyCharm

from retrying import retry


@retry(stop_max_attempt_number=3)
def work():
    try:
        print('代码测试')
        raise TimeoutError
    except Exception as e:
        print('123:', e)
    finally:
        print('456')


work()


"""
retry不能和try语句组合使用
"""